package model.dao;

import java.util.ArrayList;
import model.dao.ulti.HibernateUtil;
import model.pojo.ChiTietDanhMuc;
import org.hibernate.Query;
import org.hibernate.Session;

public class ChiTietDanhMucDAO extends AbstractDAO<ChiTietDanhMuc, String> {

    @Override
    protected Class getPOJOClass() {
        return ChiTietDanhMuc.class;
    }
     public ArrayList<ChiTietDanhMuc>  getChiTietDanhMuc(String maDM){
        Session session = HibernateUtil.getSessionFactory().openSession();
        String hql = "from ChiTietDanhMuc s where s.danhMuc.maDanhMuc =:madm";
        Query query = session.createQuery(hql);
        query.setString("madm", maDM);
        ArrayList<ChiTietDanhMuc> ds = (ArrayList<ChiTietDanhMuc>) query.list();
        return ds;
    }
}
